import superr from '@/common/components/superr.js'
export default class page extends superr {
  labelWidth = 78
  horizon = true
  tree = {
    tree: {
      vertical: true, //表单label在上面不是左边
      type: 'tree',
      checkbox: false,
      options: [],
      style: { height: '678px', 'min-height': '678px' },
      txtChange: function (tree, input, options, data) {},
      nodeClick: function (node, options, data) {},
      init: function (tree, options, data) {
        this.search(tree, '', options, data)
      },
      search: function (tree, input, options, data) {
        tree.clearAll()
        setTimeout(() => {
          let tmp = [
            {
              label: $t('common.quanbu'),
              children: [
                {
                  label: '二级 1-1',
                  children: [
                    {
                      label: '二级 1-1',
                    },
                    {
                      label: '二级 1-2',
                      children: [
                        {
                          label: '二级 1-1',
                        },
                        {
                          label: '二级 1-2',
                          children: [
                            {
                              label: '二级 1-1',
                            },
                            {
                              label: '二级 1-2',
                              children: [
                                {
                                  label: '二级 1-1',
                                },
                                {
                                  label: '二级 1-2',
                                  children: [
                                    {
                                      label: '二级 1-1',
                                    },
                                    {
                                      label: '二级 1-2',
                                      children: [
                                        {
                                          label: '二级 1-1',
                                        },
                                        {
                                          label: '二级 1-2',
                                          children: [
                                            {
                                              label: '二级 1-1',
                                            },
                                            {
                                              label: '二级 1-2',
                                              children: [
                                                {
                                                  label: '二级 1-1',
                                                },
                                                {
                                                  label: '二级 1-2',
                                                  children: [
                                                    {
                                                      label: '二级 1-1',
                                                    },
                                                    {
                                                      label: '二级 1-2',
                                                    },
                                                  ],
                                                },
                                              ],
                                            },
                                          ],
                                        },
                                      ],
                                    },
                                  ],
                                },
                              ],
                            },
                          ],
                        },
                      ],
                    },
                  ],
                },
                {
                  label: '二级 1-2',
                },
              ],
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
            {
              label: '一级 2',
            },
          ]
          tmp.forEach(element => {
            tree.push(element)
          })
        }, 3000)
      },
    },
  }
  search = {
    input: {
      type: 'input',
      vertical: true, //表单label在上面不是左边
      style: { width: '260px', 'margin-right': '10px' },
      enter: function (val, option, data) {
        // debugger
      },
    },
  }
  table = {
    table: {
      class: 'cpt_round_card',
      type: 'table',
      vertical: true, //表单label在上面不是左边
      page: 1,
      size: 10,
      total: 10,
      sizeChange(size, options, data) {
        this.size = size
      },
      pageChange(page, options, data) {
        this.page = page
      },
      filterChange(filters, options, data) {
        console.log(this)
      },
      sortChange(order, field, options, data) {
        console.log(this)
      },
      columns: [
        {
          prop: 'datasetName',
          label: '数据集名称',
          sortable: 'custom',
          filters: [
            { text: 'qwe', value: 'qwe' },
            { text: 'asd', value: 'asd' },
          ],
          formatter: function formatter(data) {
            return `<div>${data.value}</div>`
          },
          event: function (data) {
            console.log(data)
          },
        },
        {
          isOperation: true,
          width: 160,
          label: '操作',
        },
      ],
    },
  }
  constructor(data) {
    super(data)
  }
}
